﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class branch
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _branch_id = -99;
        private string _address = "";
        private string _description = "";
        private string _school_image = "";
        private string _branch_manager = "";
        private bool _isdeleted = false;
        public long branch_id
        {
            get
            {
                return _branch_id;
            }
            set
            {
                _branch_id = value;
            }
        }
        public string address
        {
            get
            {
                return _address;
            }
            set
            {
                _address = value;
            }
        }
        public string description
        {
            get
            {
                return _description;
            }
            set
            {
                _description = value;
            }
        }
        public string school_image
        {
            get
            {
                return _school_image;
            }
            set
            {
                _school_image = value;
            }
        }
        public string branch_manager
        {
            get
            {
                return _branch_manager;
            }
            set
            {
                _branch_manager = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@branch_id", branch_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@address", address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@description", description, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@school_image", school_image, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@branch_manager", branch_manager, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                return DAC.Save("branch_save", dbparamcall);
            }
            catch (Exception ex)
            {
                //long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long branch_id, string address, string description, string school_image, string branch_manager, bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@branch_id", branch_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@address", address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@description", description, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@school_image", school_image, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@branch_manager", branch_manager, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6 };
                DataTable dt1 = DAC.Select("branch_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                //long Result = -99;
            }
            return null;
        }
    }
}
